﻿using System;
using System.Windows.Data;
using Facebook.Service;

namespace FacebookPhotosLiveWriterPlugin.Converters
{
    public class AlbumToPhotoListConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            AlbumInfo photoAlbum = value as AlbumInfo;

            if (photoAlbum != null)
            {
                if (photoAlbum.ID == "0")
                {
                    return FacebookPlugin.Service.Photos.GetPhotosOfUser(FacebookPlugin.Service.UserID);
                }
                if (photoAlbum.CoverID != "0")
                {
                    return FacebookPlugin.Service.Photos.GetPhotos(photoAlbum.ID);
                }
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
